export type DecisionOperator =
  | EqualOperator
  | NotEqualOperator
  | GreaterThanOperator
  | GreaterThanOrEqualOperator
  | LessThanOperator
  | LessThanOrEqualOperator;

type EqualOperator = {
  operator: '==';
  value: string | number | boolean;
};
type NotEqualOperator = {
  operator: '!=';
  value: string | number | boolean;
};
type GreaterThanOperator = {
  operator: '>';
  value: string | number | boolean;
};
type GreaterThanOrEqualOperator = {
  operator: '>=';
  value: string | number | boolean;
};
type LessThanOperator = {
  operator: '<';
  value: string | number | boolean;
};
type LessThanOrEqualOperator = {
  operator: '<=';
  value: string | number | boolean;
};

export class OpDecision {
  equal(property: string, value: EqualOperator['value']) {
    return {
      operator: '==',
      property,
      value,
    };
  }
  notEqual(property: string, value: NotEqualOperator['value']) {
    return {
      operator: '!=',
      property,
      value,
    };
  }
  greaterThan(property: string, value: GreaterThanOperator['value']) {
    return {
      operator: '>',
      property,
      value,
    };
  }
  greaterThanOrEqual(
    property: string,
    value: GreaterThanOrEqualOperator['value'],
  ) {
    return {
      operator: '>=',
      property,
      value,
    };
  }
  lessThan(property: string, value: LessThanOperator['value']) {
    return {
      operator: '<',
      property,
      value,
    };
  }
  lessThanOrEqual(property: string, value: LessThanOrEqualOperator['value']) {
    return {
      operator: '<=',
      property,
      value,
    };
  }
}
